home *** CD-ROM | disk | FTP | other *** search
- /* Find all unread mail to me, then copy it into a netmail, also to me */
- /* This demo doesn't mark mail as 'Rcvd' afterwards!! */
-
- #include <stdio.h>
- #include <conio.h>
- #include <stdlib.h>
- #include <string.h>
- #include "mb_lib.h"
-
- int putln (char *); /* proto */
-
- void main () {
- MSGTOIDX_RECORD myname = "Frank Van.wensveen";
- MSGHDR_RECORD msghdr; /* Echomail header */
- NET_RECORD nethdr; /* Netmail header */
- M_TEXT msgtxt; /* Text handle */
- char msgpath [MAXPATH];
- long msgnr;
-
- strcpy (msgpath, "C:\\MSGBASE"); /* Fill in your own path */
- if (msg_open (msgpath)) {
- puts ("Error opening message base");
- exit (-1);
- }
- clrscr ();
- msgnr = msg_firstto (& myname); /* Find mail to me */
- while (msgnr != -1) {
- msg_read_hdr (msgnr, & msghdr); /* Read header */
- net_hdr_clear (& nethdr);
- strcpy (nethdr.who_from, msghdr.who_from); /* Copy to net hdr */
- strcpy (nethdr.who_to, msghdr.who_to);
- strcpy (nethdr.subject, msghdr.subject);
- printf ("Msg. nr. %d --> netmail\n", msghdr.msgnum);
- msgtxt = msg_read_text (& msghdr); /* Read msg text */
- net_write (msgpath, net_last (msgpath) + 1, & nethdr, msgtxt);
- msgnr = msg_nextto (msgnr); /* Write and repeat */
- }
- msg_close ();
- }